package com.comprehensive.dataservice.feign;

import com.comprehensive.common.dto.PageResponse;
import com.comprehensive.dataservice.entity.Dictionary;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Dictionary服务Feign客户端接口
 * 用于调用data-access-service服务的字典项管理接口
 */
//@FeignClient(name = "data-access-service")
public interface DictionaryFeignClient {

    /**
     * 获取所有字典项
     * @return 字典项列表
     */
    @GetMapping("/dictionary")
    List<Dictionary> getAllDictionaries();

    /**
     * 根据ID获取字典项
     * @param id 字典项ID
     * @return 字典项详情
     */
    @GetMapping("/dictionary/{id}")
    Dictionary getDictionaryById(@PathVariable("id") Long id);

    /**
     * 创建新字典项
     * @param dictionary 字典项信息
     * @return 是否创建成功
     */
    @PostMapping("/dictionary")
    boolean createDictionary(@RequestBody Dictionary dictionary);

    /**
     * 更新字典项
     * @param dictionary 新的字典项信息
     * @return 是否更新成功
     */
    @PutMapping("/dictionary")
    boolean updateDictionary(@RequestBody Dictionary dictionary);

    /**
     * 删除字典项
     * @param id 字典项ID
     * @return 是否删除成功
     */
    @DeleteMapping("/dictionary/{id}")
    boolean deleteDictionary(@PathVariable("id") Long id);

    /**
     * 多条件查询字典项
     * @param dictType 字典类型
     * @param dictCode 字典编码
     * @param status 状态(0-禁用,1-启用)
     * @param pageNum 页码
     * @param pageSize 每页大小
     * @return 分页查询结果
     */
    @GetMapping("/dictionary/search")
    PageResponse<Dictionary> searchDictionaries(
            @RequestParam(value = "dictType", required = false) String dictType,
            @RequestParam(value = "dictCode", required = false) String dictCode,
            @RequestParam(value = "status", required = false) Integer status,
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "10") Integer pageSize);
    /**
     * 根据字典类型或字典编码查询字典项
     * @param dictType 字典类型
     * @param dictCode 字典编码
     * @return 字典项列表
     */
    @GetMapping("/dictionary/queryDictionariesByTypeOrCode")
    List<Dictionary> queryDictionariesByTypeOrCode(@RequestParam(required = false) String dictType, @RequestParam(required = false) String dictCode);
    }